package com.lwj.liwanjia.adapter;

import android.content.Context;
import android.widget.ImageView;

import com.bumptech.glide.Glide;
import com.lwj.liwanjia.R;
import com.lwj.liwanjia.bean.SpBean;
import com.superrecycleview.superlibrary.adapter.BaseViewHolder;
import com.superrecycleview.superlibrary.adapter.SuperBaseAdapter;

import java.util.List;

/**
 * Created by Administrator on 2017/10/31.
 */

public class DzsmAdapter extends SuperBaseAdapter<SpBean.DataBean.RefferBean> {
    private Context mContext;

    public DzsmAdapter(Context context, List<SpBean.DataBean.RefferBean> data) {
        super(context, data);
        mContext = context;
    }

    @Override
    protected void convert(BaseViewHolder holder, SpBean.DataBean.RefferBean item, int position) {
        Glide.with(mContext).load(item.getImageaddress()).error(R.mipmap.test).into((ImageView) holder.getView(R.id.iv_left));
        holder.setText(R.id.tv_name_china, item.getMsg_type())
                .setText(R.id.tv_name_englist, item.getEnglish())
                .setText(R.id.tv_yongHuPinJia, item.getText());
    }

    @Override
    protected int getItemViewLayoutId(int position, SpBean.DataBean.RefferBean item) {
        if (position % 2 == 0) {
            return R.layout.adapter_shape_fzc_01;
        }
        return R.layout.adapter_shape_fzc_02;
    }
}
